﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WHControlLib.CommonHelpers;
using WHControlLib.Controls.Goods;
using WHControlLib.Forms;

namespace WHUIdemo.Forms.PosDemoPageFrm
{

    public delegate void TransparentPriceToCurrentGoods(double d);
    public partial class ChangCoodsPriceFrm : WHDialogFrm
    {
        Goods InGoods;
     public    TransparentPriceToCurrentGoods TranPriceGoods;
        public ChangCoodsPriceFrm(Goods inGoods)
        {
            InGoods = inGoods;
            InitializeComponent();
        }

        private void ChangCoodsPriceFrm_Load(object sender, EventArgs e)
        {
            if (InGoods != null)
            {
                whLable1.Text = "商品名：" + InGoods.Name + "\n" + "条码：" + InGoods.barcode
                                 + "\n" + "价格：￥" + InGoods.Price.ToString("F2");
            }
        }

        private void whNumKeyBoard1_OKButtonCLick(object sender, EventArgs e)
        {

            if (DataCheckHelper.isNumber(whTextBox1.Text.Trim()))
            {
                double d = Math.Round(Convert.ToDouble(whTextBox1.Text.Trim()), 2);
                TranPriceGoods(d);
            }
            this.Close();
        }

        private void ChangCoodsPriceFrm_Activated(object sender, EventArgs e)
        {
            whTextBox1.Focus();
        }
    }
}
